package com.sghd.football.module.game.service;

import com.sghd.common.socket.core.Message;
import com.sghd.common.socket.session.SessionManager;
import com.sghd.football.module.game.service.model.Window;
import com.sghd.football.net.SocketEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author wch
 * @date 2018-06-08 10:34
 * @desc 弹窗服务
 **/
@Component
public class DialogService {

    @Autowired
    private SessionManager sessionManager;

    /**
     * 标准弹窗
     **/
    public static String WINDOW_T = "T";
    /**
     * 浮动窗（浮动几秒后自动消失）
     **/
    public static String WINDOW_F = "F";
    /**
     * 飘窗（从边缘进入，中间停留，然后再出去）
     **/
    public static String WINDOW_P = "P";

//    public static final int BT_CLOSE = -1; // ---关闭
//    public static final int BT_OK = 0; // ---确定
//    public static final int BT_CANCEL = 1; // ---取消
//    public static final int BT_EXIT = 2; // ---退出应用

    /** 返回大厅*/
    public static final int BT_TOHALL = 10;

    /**
     * 弹窗
     *
     * @param type 弹窗类型
     * @param obj  内容
     * @param ids  玩家id
     */
    public void dialog(Window window, Object... ids) {
        Message message = Message.valueOf(SocketEnum.INFO, window.getWindows());
        sessionManager.send(message, ids);
    }

}
